package com.hsteach.web.controller.meeting;

import com.hsteach.common.annotation.Anonymous;
import com.hsteach.common.core.controller.BaseController;
import com.hsteach.common.core.domain.AjaxResult;
import com.hsteach.service.meeting.MeetingPersonService;
import com.hsteach.web.controller.meeting.dto.MeetingPersonDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "会议参会人员")
@RestController
@RequestMapping("/meeting/person")
public class MeetingPersonController extends BaseController {

    @Resource
    private MeetingPersonService meetingPersonService;


    @ApiOperation("查询会议参会人员信息")
    @GetMapping("queryPersonInfo/{applyId}")
    public AjaxResult queryPersonInfo(@PathVariable("applyId") Long applyId){
        return success(meetingPersonService.queryPersonInfo(applyId));
    }

    @ApiOperation("新增会议参会人员")
    @PostMapping("add")
    public AjaxResult add(@RequestBody MeetingPersonDto dto){
        return success(meetingPersonService.add(dto));
    }

    @ApiOperation("签到")
    @PostMapping("signIn")
    @Anonymous
    public AjaxResult signIn(@RequestParam("applyId") Long applyId, @RequestParam("signCode") String signCode){
        return success(meetingPersonService.signIn(applyId, signCode));
    }

    @ApiOperation("生成签到码")
    @PostMapping("genSignCode")
    @Anonymous
    public AjaxResult genSignCode(@RequestParam("applyId") Long applyId){
        return AjaxResult.success("生成签到码成功", meetingPersonService.genSignCode(applyId));
    }


}
